#pragma once
#include<string>
#include<iostream>
#define die(code) do{exit(code);} while(0)
#define conv(v) (struct sockaddr*)(v)

enum{

    usage_error = 1,
    socket_error,
    bind_error,
    listen_error
};

bool splitString(const std::string &line, std::string* key, 
    std::string *value, const std::string& step)
{
    auto pos = line.find(step);
    if (pos == std::string::npos) return false;
    *key = line.substr(0, pos);
    *value = line.substr(pos + step.size());
    if (key->empty() || value->empty()) return false;
    return true;
}

